#ifndef TCPCLIENT_H
#define TCPCLIENT_H

#include <QString>
#include <QTcpSocket>

class TCPClient : public QObject
{
    Q_OBJECT
public:
    TCPClient();
    ~TCPClient();
    void connectToServer(QString ip = QString::number(QHostAddress::LocalHost), quint16 port = 8090);//连接服务器,默认为本机8090

signals:
    void clientRename(QString _name);

public slots:
    void sendMessage(QString message);     //发送消息
    void disconnectFromHost();             //断开连接
    void receiveName();

private:
    QTcpSocket *m_socket;
};

#endif // TCPCLIENT_H
